#pragma once
#include <memory>
#include <vector>

class IArrayRangeSum
{
public:
	virtual void initNums(const std::vector<int>& nums) = 0;
	virtual int sumRange(int left, int right) = 0;

	virtual std::shared_ptr<IArrayRangeSum> clone() = 0;
};
extern IArrayRangeSum* ArrayRangeSumFactory;

class ArrayUtil
{
public:
	static std::shared_ptr<IArrayRangeSum> genRangeSumCalculator(const std::vector<int>& nums);
};

